#include <cstdio>
#include <algorithm>
using namespace std;
#define DEBUG
const int N=3e5+10;
int ans, sum[N], n, m, boom[N];

int main()
{
    #ifdef DEBUG
        freopen("./in.txt", "r", stdin);
        // freopen("./out.txt", "w", stdout);
    #endif
    scanf("%d%d", &n, &m);
    for(int i=1; i<=n; i++) scanf("%d", &boom[i]), sum[i]+=sum[i-1]+boom[i];
    
    for(int i=1, j=m+1; j<=n; i++, j++)
    {
        ans=max(ans, sum[j]-sum[i-1]);
    }
    printf("%d\n", ans);
    return 0;
}